APP_NAME = WiFiCamera_Server

TARGET = $(APP_NAME)

CC = gcc

CFLAGS = -Wall -c
LDFLAGS = -pthread -ljson-c -L/usr/local/json-c/json-c_x86/lib/
INCLUDE = -I./ -I/usr/local/json-c/json-c_x86/include/

OBJ_SRC := $(patsubst %.c, %.o, $(wildcard *.c))

all:$(TARGET)

$(TARGET):$(OBJ_SRC)
	@mkdir -p output/
    #如果 A调用了B, B调用了C，那么链接时必须: 先链接A,再链接B,再链接C
	$(CC) $^ $(LDFLAGS) -o output/$@

%.o:%.c
	$(CC) $(INCLUDE) $(CFLAGS) $< -o $@

.PHONY:clean
clean:
	rm -rf $(OBJ_SRC) output/